# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Tobias Kieslich <tobias@justdreams.de>

pkgbase=ghex
pkgname=(
  ghex
  ghex-docs
)
pkgver=44.1
pkgrel=1
pkgdesc="A simple binary editor for the Gnome desktop"
url="https://wiki.gnome.org/Apps/Ghex"
arch=(x86_64)
license=(GPL)
depends=(libadwaita)
makedepends=(
  gi-docgen
  git
  gobject-introspection
  meson
  yelp-tools
)
_commit=128561d95b1d5088a27d5ad4ebe7bab265437d7a  # tags/44.1^0
source=("git+https://gitlab.gnome.org/GNOME/ghex.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd ghex
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd ghex
}

build() {
  arch-meson ghex build -D gtk_doc=true
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_ghex() {
  provides=(libgtkhex-4.so)
  groups=(gnome-extra)

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc
}

package_ghex-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
